home *** CD-ROM | disk | FTP | other *** search
Wrap
/* IMAGE FX MOVING SPOTLIGHTS By J.L. White ©1994 Merlin's Software Load Image & Add A Moving SpotLight To Series Of Frames ImageFX Script Requires The Rexxarplib.library Batch Factory Batch Conversion Scripts are basically Arexx scripts that allow you to pass certain parameters to the external program you wish to use to convert the images from one format to another. You can pass five different strings from Batch Factory to the script by using the following commands: $N = This will pass the current selected filename. $P = This will tell Batch Factory to ask for a path to save new frames to. $# = This will pass the current frame number in the script. $T = This will pass the total number of frames in the script. $A = This will pass an offset number to be used to save frames with. NOTE: The following line is required to work as a Batch Factory Script: PARSE=$N $P $# $A $T */ if ~show('l', "rexxarplib.library") then do check = addlib('rexxsupport.library',0,-30,0) check = addlib('rexxarplib.library',0,-30,0) end options results call Locate_ImageFX address "IMAGEFX.1" arg InPic OutPic FrameNum AddNum TotalNum SaveNum = FrameNum + AddNum if FrameNum = 1 then do Top = 170 Height = ScreenRows("Batch") if Height < 400 then Top = 70 address "AREXX" ScreenToFront("Batch") call GetMotionPath address "IMAGEFX.1" ScreenToFront RequestSlider '"Enter Amount To Darken Image!"' 1 127 75 Answer = -Result RequestSlider '"Enter Radius Of SpotLight!"' 1 200 50 Answer2 = Result RequestSlider '"Enter Amount To Feather SpotLights!"' 1 50 5 Answer3 = Result RequestSlider '"Enter Number Of SpotLights!"' 1 2 1 Answer4 = Result call open TempFile,"Ram:IFMS",W call writeln TempFile,Answer call writeln TempFile,Answer2 call writeln TempFile,Answer3 call writeln TempFile,Answer4 call close TempFile end else do call open TempFile,"Ram:IFMS",R line = readln(TempFile) parse var line Answer line = readln(TempFile) parse var line Answer2 line = readln(TempFile) parse var line Answer3 line = readln(TempFile) parse var line Answer4 call close TempFile end address "IMAGEFX.1" DrawMode Normal ActiveColor 1 LoadBuffer InPic Force Smooth Undo Off Redraw Off GetMain parse var result Name Width Height Blah call GetXYCords Buffer2Swap ClearBuffer Force 0 0 0 AlphaChannel Off EdgeMode FeatherOut Answer3 FilledOval X Y Answer2 Answer2 if Answer4 = 2 then FilledOval Width-X Y Answer2 Answer2 EdgeMode Normal Buffer2Alpha Swap Buffer2Swap Brightness Answer AlphaChannel FRISKET Merge 100 Alpha Redraw On Undo On if OutPic = "SAME" then SaveBufferAs ILBM InPic else SaveBufferAs ILBM OutPic""right(SaveNum,3,'0') if FrameNum = TotalNum then do address command "Delete >NIL: Ram:IFMS" address command "Delete >NIL: RAM:TimeLine.File" end exit Locate_ImageFX: if (POS('IMAGEFX.1',SHOW('Ports')) = 0) then do address command 'run < nil: > nil: IMAGEFX:ImageFX' address command 'wait 7' end return GetMotionPath: address arexx "'call CreateHost(BFHOST,BFPORT,"MOUSESCREEN")'" call Delay(30) Width = 320 Height = 200 XOff = 0 YOff = 0 call Request(190,(Top+6)-14,"Select Screen Width Of Images!",,"HIRES","LORES","Batch") if result = "OKAY" then do Settings = "HIRES" Width = 640 end else Settings = "" call Request(180,(Top+6)-14,"Select Screen Height Of Images!",,"LACE","NOLACE","Batch") if result = "OKAY" then do Settings = Settings"+LACE" Height = 400 end if Height = 400 & Width = 640 then do call Request(185,(Top+6)-14," Select Over Scan Option!",,"OVERSCAN","REGULAR","Batch") if result = "OKAY" then do Settings = Settings"+OVERSCAN+AUTOSCROLL" call Request(180,(Top+6)-14," Enter New Screen Width!","736","OKAY",,"Batch") Width = result XOff = 640 - Width call Request(180,(Top+6)-14," Enter New Screen Height!","480","OKAY",,"Batch") Height = result YOff = 400 - Height end end result = OpenScreen(YOff,3,Settings,'','MOUSESCREEN',,Width,Height,XOff) Height = ScreenRows("MOUSESCREEN") Width = ScreenCols("MOUSESCREEN") idcmp = 'CLOSEWINDOW+GADGETUP+MOUSEMOVE+MOUSEBUTTONS' flags = 'BORDERLESS+BACKDROP+REPORTMOUSE' call OpenWindow(BFHOST, 0, 0, Width, Height, idcmp, flags, ) call ShowTitle("MOUSESCREEN",0) call ModifyHost(BFHOST, MOUSEMOVE, "%l %x %y") call ModifyHost(BFHOST, MOUSEBUTTONS, "%b %x %y") call AddGadget(BFHOST,15,8,"OK"," OKAY ","OK") SetAPen(BFHOST,1) SetDrMd(BFHOST,JAM2) call Move(BFHOST,0,Height%2) call Draw(BFHOST,Width,Height%2) call Move(BFHOST,Width%2,0) call Draw(BFHOST,Width%2,Height) call Move(BFHOST,0,0) call Draw(BFHOST,0,Height) call Move(BFHOST,0,0) call Draw(BFHOST,Width,0) call Move(BFHOST,Width-1,0) call Draw(BFHOST,Width-1,Height) call Move(BFHOST,0,Height-1) call Draw(BFHOST,Width,Height-1) call ActivateWindow(BFHOST) call Request((Width-304)%2,(Height-60)%2,"Draw Line By Moving The Mouse.\Click Mouse To Change Direction.\Click OKAY When You Are Done.",,"OK",,"MOUSESCREEN") xpos = 0 ypos = 0 xm = -1 ym = -1 quitflag = 0 Start = 0 i = 0 call openport(BFPORT) do until quitflag = 1 call waitpkt(BFPORT) packet = getpkt(BFPORT) if packet ~= null() then do cmd = getarg(packet) call reply(packet,0) if cmd = OK then do call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) call ImageOK end else do parse var cmd button x y if (button == 'MOUSEMOVE' & Start > 0) then do call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) xm = x ym = y call SetDrMd(BFHOST,COMPLEMENT) call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) end else if button == 'SELECTDOWN' then do Start = Start + 1 if Start = 1 then do xpos = x ypos = y i = i + 1 XPosition.i = xpos YPosition.i = ypos xm = x ym = y call SetDrMd(BFHOST,COMPLEMENT) call Move(BFHOST,xpos,ypos) call Draw(BFHOST,xm,ym) call PrintText end end else if(button == 'SELECTUP') then do i = i + 1 if x = Width - 1 then x = Width if y = Height -1 then y = Height XPosition.i = x YPosition.i = y call PrintText xpos = x ypos = y end end end end call CloseWindow(BFHOST) result = CloseScreen('MOUSESCREEN') call ClosePort(BFPORT) return AbortIt: call CloseWindow(BFHOST) result = CloseScreen('MOUSESCREEN') call ClosePort(BFPORT) call Request(200,(Top+36)-14,"Process Has Been Cancelled\Please Abort Script!!",,"OK",,"Batch") address command "Wait 2" exit return ImageOK: call Request((Width-232)/2,(Height-70)/2,"Is The Time Line Correct?",,"OK","CANCEL","MOUSESCREEN") if result = "OKAY" then do quitflag = 1 call open OutData,"RAM:TimeLine.File",'W' do x = 2 to i call writeln OutData,XPosition.x""YPosition.x end call close OutData end else do xpos = 0 ypos = 0 xm = -1 ym = -1 Start = 0 i = 0 call BackFill(BFHOST) call RefreshGadgets(BFHOST) SetAPen(BFHOST,1) SetDrMd(BFHOST,JAM2) call Move(BFHOST,0,Height/2) call Draw(BFHOST,Width,Height/2) call Move(BFHOST,Width/2,0) call Draw(BFHOST,Width/2,Height) call Move(BFHOST,0,0) call Draw(BFHOST,0,Height) call Move(BFHOST,0,0) call Draw(BFHOST,Width,0) call Move(BFHOST,Width-1,0) call Draw(BFHOST,Width-1,Height) call Move(BFHOST,0,Height-1) call Draw(BFHOST,Width,Height-1) end return PrintText: SetAPen(BFHOST,1) SetDrMd(BFHOST,JAM2) call Move(BFHOST,85,16) YText = strip(y) call Text(BFHOST,"Key Frame #"right(i-1,3,'0')" X="right(x,3,'0')" Y="right(YText,3,'0')) SetAPen(BFHOST,2) SetDrMd(BFHOST,JAM1) return GetXYCords: i = 0 call open KeyData,"RAM:TimeLine.File",'R' do until eof(KeyData) i = i + 1 line = readln(KeyData) parse var line XCord.i' 'YCord.i end call close KeyData TotalKey = i-2 NumKey = (TotalNum/TotalKey) FirstNum = ((NumKey - (NumKey-(FrameNum-1)))%NumKey)+1 SecNum = FirstNum+1 if FirstNum = TotalKey then do NumKey = NumKey - 1 NewNum = (((FrameNum-((FirstNum-1)*NumKey)))-(TotalKey-1)) end else NewNum = ((FrameNum-((FirstNum-1)*NumKey))) X1 = XCord.FirstNum Y1 = YCord.FirstNum X2 = XCord.SecNum Y2 = YCord.SecNum if X2 < X1 then do DiffX = -((X1-X2)/(NumKey)) end else do DiffX = ((X2-X1)/(NumKey)) end if Y2 < Y1 then do DiffY = -((Y1-Y2)/(NumKey)) end else do DiffY = ((Y2-Y1)/(NumKey)) end X = (X1 + (DiffX*NewNum))-DiffX Y = (Y1 + (DiffY*NewNum))-DiffY X = X % 1 Y = Y % 1 return